<%@ Page Language="C#" EnableViewState="false" ValidateRequest="false" AutoEventWireup="true" 
	 MasterPageFile="~/App_ThemeMasters/NoStyle/AdminOneColumnLayout.Master" Inherits="Syrinx.Gui.AspNet.Ajax.NitobiBasePage" %>
<%@ Register Assembly="Swaf.Gui.AspNet2" Namespace="Swaf.Gui.AspNet2" TagPrefix="swf" %>
<%@ Register Assembly="ScsAspNet" Namespace="Syrinx.Gui.AspNet.Ajax" TagPrefix="saj" %><%@ Register Assembly="NitobiControls" Namespace="Nitobi" TagPrefix="ntb" %>
<%@ Register Assembly="ScsAspNet" Namespace="Articles.Gui.AspNet" TagPrefix="art" %>

<!--#include file="~/SiteControls/RegisterStandardControls.txt"-->
<!--#include file="../SiteControls/StandardAdminHeaderPageContent.inc"-->
<!--#include file="../SiteControls/StandardFooterPageContent.inc"-->

<script runat="server">
	public string TitleFormat = "$company.name$ - Article Management";
</script>

<asp:Content ID="c1" ContentPlaceHolderID="title" runat="server">
	<%SecurityPrivilege = "AppFunctions.ManageArticles"; %>
	<h1 ID="_ImgCacheLibLbl" runat="server">Article Management</h1>
    <swf:BizProc ID="gArt1" runat="server" FactoryName="genericArticles">
		<State pid="" entireTree="true" isPaging="true" EditModeSessionKey="GlobalEdit" listDetailLevel="basicDetails" stripLeading="False" includeCounts="true" />
		<ParentBizProc id="loginBP" />
    </swf:BizProc>
</asp:Content>

<asp:Content ID="c2" ContentPlaceHolderID="trails" runat="server">
<script type="text/javascript">
function toggleTabs(cId,c1, dId){
	for(i=1; ;i++){
		var a = document.getElementById(cId + i);
		var b = document.getElementById(dId + i);
		if(a==null || a=='')
			break;
			
		if(i==c1){
			a.className = 'currenttab';
			b.style.display = 'block';
		}
		else{
			a.className='';
			b.style.display = 'none';
		}
	}
}
</script>

	<div style="float:right">
	<table><tr><td valign="bottom">
	</td><td align="right">
		<span class="AjaxIndi" style="display:none"><img src="/images/indicator.gif" /></span>
        <span class="button6"><saj:ActionButton runat="server" ID="updateBtn1" Actions="gArt1.UpdateBizObj" Text="Update" /></span>
	    <span class="button1"><saj:ActionButton runat="server" ID="addBtn" Actions="gArt1.AddBizObj" Text="Add" /></span>
	    <span class="button2"><saj:ActionButton runat="server" ID="cancelBtn" Actions="gArt1.CancelEdits" Text="Cancel" /></span>
	    <span class="button5"><saj:ActionButton runat="server" ID="deleteBtn" Actions="gArt1.DeleteBizObj" Text="Delete" ClientClick="if(!confirm('Are you sure you want to delete?'))return false;"/></span>
		<span class="button1"><saj:ActionButton runat="server" ID="translationBtn" Actions="gArt1.SwitchTranslation" Text="Translate" SessionBoolSwitch="TranslationMode" /></span>
	    <span class="button5"><saj:ActionButton runat="server" ID="clearImgBtn" Actions="gArt1.ClearArticlePicture" Text="Remove Image" ClientClick="if(!confirm('Are you sure you want to remove the primary image?'))return false;"/></span>
	    <span class="button1"><saj:ActionButton runat="server" ID="setPicBtn" Actions="gArt1.SetArticlePicture" Text="Set Image" 
		    PopupPage="../popups/SetArticleImagePopup.aspx" PopupHeight="550px" PopupWidth="800px" PopupTitle="Select a primary image for this article." /></span>
	    <span class="button4"><saj:ActionButton runat="server" ID="editMode" Actions="gArt1.SwitchEdit" Text="Edit" SessionBoolSwitch="GlobalEdit" /></span>
	 </td><td>
	<div class="HelpBtnArea">
		<asp:HyperLink runat="server" ID="_pageHelp" NavigateUrl="../std/Help.aspx?helpid=ArticleManagementHelp" Target="help">Help</asp:HyperLink>
	</div>
	 </td></tr></table>
	 </div>
	 <div class="clearer"></div>
	 
</asp:Content>

<asp:Content ID="c3" ContentPlaceHolderID="mainContent" runat="server">
	<table class="adminPageWidth" ><tr><td >
    <div class="SimpleVerticalBg"> 
		<table><tr><td>
	    <saj:Grid ID="articleList1Display" runat="server" Width="350px" Height="600px"
		    ParentBizProcIds="gArt1" Mode="LiveScrolling" Resizable="Both" >
		    <Columns>
			    <ntb:KeyColumn DataField="id" />
			    <ntb:BoundColumn DataField="depthName" HeaderText="Name" width="315" />
			    <ntb:BoundColumn DataField="uniqueTitle" HeaderText="Unique Title" Width="150" />
			    <ntb:BoundColumn DataField="counts.dateUpdatedDisplayDate" HeaderText="Last Updated" Width="150" />
			    <ntb:BoundColumn DataField="counts.lastChildUpdatedBy.userName" HeaderText="Updated By" Width="150" />
		    </Columns>
	    </saj:Grid>
	    </td></tr></table>
    </div>
</td><td class="adminRightContentWidth">
		<div class="tabs">
			<ul>
				<li id="t1" class="currenttab"><div class="firstTab"><swf:DivLayers runat="server" ID="tl1" SkinID="Tab"><asp:HyperLink onclick="toggleTabs('t','1','ta');" runat="server" ID="_cmpMngrTab1" Text="Article" NavigateUrl="javascript:;" /></swf:DivLayers></div></li>
				<li id="t2"><swf:DivLayers runat="server" ID="tl2" SkinID="Tab"><asp:HyperLink runat="server" onclick="toggleTabs('t','2','ta');" ID="_pubInfLbl" Text="Publishing Info" NavigateUrl="javascript:;" /></swf:DivLayers></li>
				<li id="t3"><div class="lastTab"><swf:DivLayers runat="server" ID="tl3" SkinID="Tab"><asp:HyperLink runat="server" onclick="toggleTabs('t','3','ta');" ID="_cmpMngrTab3" Text="Advanced" NavigateUrl="javascript:;" /></swf:DivLayers></div></li>
			</ul>
		</div>
	<swf:DivLayers ID="mdl1" runat="server" SkinID="MainTabArea">
		<div id="ta1">
	        <art:ArticleTranslationDisplay runat="server" ID="ad1"
		        ParentBizProcIds="gArt1" 
		        TranslationTemplate="Articles.Gui.AspNet.ArticleTranslationRWDisplay"
		        ReadOnlyTemplate="Articles.Gui.AspNet.ArticleRODisplay"
		        EditableTemplate="Articles.Gui.AspNet.ArticleRWDisplay" >
		        <macros imageRes="Thumbnail" />
	        </art:ArticleTranslationDisplay>
	        <span class="button6"><saj:ActionButton runat="server" ID="ActionButton1" Actions="gArt1.UpdateBizObj" Text="Update" /></span>
        </div>
        
        <div id="ta2" style="display:none;">
			<saj:NitobiBizObjDisplay runat="server" ID="ad2" ParentBizProcIds="gArt1"
				EditableTemplate="Articles.Gui.AspNet.ArticleRWDisplay-PublishingInfo">
			</saj:NitobiBizObjDisplay>
			<h3><asp:Label runat="server" ID="_pubFacts" Text="Displayed Publishing Facts" /></h3>
			<saj:NitobiBizObjDisplay runat="server" ID="NitobiBizObjDisplay1" ParentBizProcIds="gArt1"
				EditableTemplate="Articles.Gui.AspNet.ArticleRODisplay-BasicPublishFacts">
			</saj:NitobiBizObjDisplay>
        </div>
        
		<div id="ta3" style="display:none;">
			<saj:NitobiBizObjDisplay runat="server" ID="ad3" ParentBizProcIds="gArt1"
				EditableTemplate="Articles.Gui.AspNet.ArticleRWDisplay-AdvancedOptions">
			</saj:NitobiBizObjDisplay>
		
			<h3><asp:Label runat="server" ID="_lbl77">File attachments</asp:Label></h3>
			<swf:BizProc ID="attachGroup" runat="server" FactoryName="articleAttachmentGroups">
				<ParentBizProc id="gArt1" fieldName="id" dataId="pid" />
			</swf:BizProc>
			<swf:BizProc ID="attachFile" runat="server" FactoryName="articleAttachments">
				<ParentBizProc id="attachGroup" fieldName="id" dataId="pid" />
				<ParentBizProc id="gArt1" fieldName="id" dataId="artId" />
			</swf:BizProc>

			<saj:Grid ID="agGrid" runat="server" Width="450px" Height="120px"  
				ShowToolbar="false" ParentBizProcIds="attachGroup" Mode="LiveScrolling">
				<Columns>
					<ntb:KeyColumn DataField="id" />
					<ntb:ComboColumn DataField="authorizedArticleId" HeaderText="Authorized Article" ValueField="id" width="280" GetDataUrl="/NitobiLiveStreamHandler.aspx" DataSourceId="getAllCompanyArticlesForFileGroup">
						<ntb:BoundColumn DataField="id" Visible="false" />
						<ntb:BoundColumn DataField="title" />
					</ntb:ComboColumn>
					<ntb:ComboColumn DataField="unauthorizedArticleId" HeaderText="Unauthorized Article" ValueField="id" width="280" GetDataUrl="/NitobiLiveStreamHandler.aspx" DataSourceId="getAllCompanyArticlesForFileGroup">
						<ntb:BoundColumn DataField="id" Visible="false" />
						<ntb:BoundColumn DataField="title" />
					</ntb:ComboColumn>
				</Columns>
			</saj:Grid>			
			<div style="margin:5px 0px 15px 0px;">
				<span class="button6"><saj:ActionButton runat="server" ID="ActionButton2" Actions="attachGroup.UpdateBizObj" Text="Update" /></span>
				<span class="button5"><saj:ActionButton runat="server" ID="ActionButton3" Actions="attachGroup.DeleteBizObj" Text="Delete" ClientClick="if(!confirm('Are you sure you want to delete?'))return false;"/></span>
		    </div>
			<saj:Grid ID="aaGrid" runat="server" Width="450px" Height="250px" RowHeight="35"  
				ShowToolbar="false" ParentBizProcIds="attachFile" Mode="LiveScrolling">
				<Columns>
					<ntb:KeyColumn DataField="id" />
					<ntb:ImageColumn DataField="gridImage" HeaderText="" width="40" />
					<ntb:BoundColumn DataField="filePathName" HeaderText="File Name" width="330" />
					<ntb:TextColumn DataField="description" HeaderText="Description" width="330" ReadOnly="false" />
					<ntb:BoundColumn DataField="fileCacheName" HeaderText="File Cache" width="120" />
				</Columns>
			</saj:Grid>			
			<div style="margin:5px 0px 15px 0px;">
				<span class="button1"><saj:ActionButton runat="server" ID="ActionButton4" Actions="attachFile.AddAttachment" Text="Add File" 
					PopupPage="../popups/AddArticleFileAttachmentPopup.aspx" PopupHeight="550px" PopupWidth="800px" PopupTitle="Select a primary image for this article." /></span>
				<span class="button5"><saj:ActionButton runat="server" ID="ActionButton5" Actions="attachFile.DeleteBizObj" Text="Delete" ClientClick="if(!confirm('Are you sure you want to delete?'))return false;"/></span>
			</div>		    
		</div>
    </swf:DivLayers>
</td></tr></table>    
</asp:Content>
